web/src/pages/[...listing].astro
621 lines · 16928 bytes
1---
2
3import Layout from '@layouts/Layout.astro';
4import ServiceList from '@components/things/ServiceList.astro';
5import Comments from '@components/things/Comments.svelte';
6import GitHubDetailedInfo from '@components/things/GitHubDetailedInfo.astro';
7import PrivacyPolicyDetails from '@components/things/PrivacyPolicyDetails.astro';
8import WebsiteDetailedInfo from '@components/things/WebsiteDetailedInfo.astro';
9import DockerDetailedInfo from '@components/things/DockerDetailedInfo.astro';
10import IosAppDetailedInfo from '@components/things/IosAppDetailedInfo.astro';
11import SocialShare from '@components/form/Social.astro';
12import DataActions from '@components/things/DataActions.svelte';
13import type { AwesomePrivacy, Section, Service } from '../types/Service';
14import { fetchData, slugify } from '@utils/fetch-data';
15import { fetchGitHubStats } from '@utils/fetch-repo-info';
16import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy';
17import { fetchWebsiteInfo } from '@utils/fetch-website-info';
18import { fetchDockerData } from '@utils/fetch-docker-instructions';
19import { fetchIosInfo } from '@utils/fetch-ios-info';
20import { parseMarkdown, formatLink } from '@utils/parse-markdown';
21import { site } from '@utils/config';
22import FontAwesome from '@components/form/FontAwesome.svelte';
23import Button from '@components/form/Button.astro';
24
25interface Props extends Service {
26 slug: string;
27 parentSection: Section;
28 categoryName: string;
29}
30
31const {
32 name,
33 description,
34 url,
35 github,
36 tosdrId,
37 iosApp,
38 icon,
39 followWith,
40 securityAudited,
41 openSource,
42 acceptsCrypto,
43 parentSection,
44 categoryName,
45} = Astro.props;
46
47
48/**
49 * Make a list of keywords, for the <meta keywords> tag
50 */
51const makeKeyWordTag = () => {
52 const keywords: string[] = [];
53 keywords.push(`open source ${parentSection.name}`);
54 keywords.push(`${parentSection.name} comparison`);
55 (parentSection.alternativeTo || []).forEach((alt: string) => {
56 keywords.push(`${alt} alternative`);
57 });
58 (parentSection.services || []).forEach((serv: Service) => {
59 keywords.push(`${serv.name} vs`);
60 });
61 keywords.push('private');
62 keywords.push('ad free');
63 keywords.push('encrypted');
64 keywords.push('open source software');
65 keywords.push('privacy respecting apps');
66 keywords.push('free tools');
67 return keywords.join(', ');
68};
69
70/**
71 * Make a page title
72 */
73const makePageTitle = () => {
74 return `${name} | ${parentSection.name} | ${categoryName} | Awesome Privacy`;
75};
76
77/**
78 * Make a string page intro, for the description tag
79 */
80const makeDescriptionTag = () => {
81 let description = `Analysis of ${name}, and other privacy-respecting ${parentSection.name} `;
82 if (parentSection.services) {
83 const serviceList = parentSection.services.map((serv: Service) => serv.name);
84 description += `Compare ${serviceList.join(' vs ')} more apps. `
85 }
86 if (parentSection.alternativeTo && parentSection.alternativeTo.length > 0) {
87 description += `The best secure encrypted alternatives to ${parentSection.alternativeTo.join(', ')} in 2024. `;
88 }
89 description += 'All this, and many more free and awesome tools and software.'
90 return description;
91};
92
93// Return a list of Services, except for the currtent one
94const filterServices = () => {
95 return parentSection.services.filter((service: Service) => service.name !== name);
96};
97
98export async function getStaticPaths() {
99 const pages = await fetchData().then((data) => {
100 const results: Array<Props> = [];
101 if (!data || !data.categories) return results;
102 (data as AwesomePrivacy).categories.forEach((category) => {
103 category.sections.forEach((section) => {
104 const services = (section.services || []).map((service) => {
105 return {
106 slug: `${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}`,
107 parentSection: section,
108 categoryName: category.name,
109 ...service,
110 };
111 });
112 results.push(...services);
113 });
114
115 });
116 return results;
117 });
118
119 return pages.map((props: Props) => {
120 return {params: { listing: props.slug }, props };
121 });
122}
123
124const makePaginationLinks = () => {
125 const allServices = parentSection.services || [];
126 const index = allServices.findIndex(item => item.name === name);
127 const previousItem = index > 0 ? allServices[index - 1].name : null;
128 const nextItem = index < allServices.length - 1 ? allServices[index + 1].name : null;
129 return { previous: previousItem, next: nextItem };
130};
131
132const { previous, next } = makePaginationLinks();
133
134
135const ignoredSites = ['github.gom', 'wikipedia.'];
136
137// Fetch detailed data about the services GitHub repo, privacy policy and website
138const githubData = github ? await fetchGitHubStats(github) : null;
139const privacyData = tosdrId ? await fetchTosdrPrivacy(tosdrId) : null;
140const iosData = iosApp ? await fetchIosInfo(iosApp) : null;
141const dockerData = await fetchDockerData(name);
142const websiteData = (url && !ignoredSites.some(ignoredSite => url.includes(ignoredSite))) ? await fetchWebsiteInfo(url) : null;
143
144const getApiEndpoint = () => {
145 return `https://api.awesome-privacy.xyz/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`;
146}
147
148---
149
150<Layout title={makePageTitle()} keywords={makeKeyWordTag()} description={makeDescriptionTag()} >
151 <main>
152 <section>
153 <div class="service-head">
154 <h2>{name}</h2>
155 <span class="url-wrap">
156 <a class="service-url" href={url}>{formatLink(url)}</a>
157 <span class="follow-with">{followWith}</span>
158 </span>
159 </div>
160 <div class="breadcrumbs">
161 <span>
162 <a href="/">Awesome Privacy</a>
163 ➔ <a href={`/${slugify(categoryName)}`}>{categoryName}</a>
164 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}>{parentSection.name}</a>
165 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`}>{name}</a>
166 </span>
167 </div>
168 <div class="intro">
169 <img
170 width="60"
171 height="60"
172 loading="lazy"
173 decoding="async"
174 class="service-icon"
175 alt={`${name} Icon`}
176 data-service-url={formatLink(url)}
177 src={icon || `https://icon.horse/icon/${formatLink(url)}`}
178 />
179 <div>
180 <p class="description" set:html={parseMarkdown(description)}></p>
181 <ul>
182 { url && (
183 <li>
184 <b>Homepage:</b>
185 <a href={url}>{formatLink(url)}</a>
186 </li>
187 )}
188 { github && (
189 <li>
190 <b>GitHub:</b>
191 <a href={`https://github.com/${github}`}>github.com/{github}</a>
192 </li>
193 )}
194 { tosdrId && (
195 <li>
196 <b>Privacy:</b>
197 <a href={`https://tosdr.org/en/service/${tosdrId}`}>{`tosdr.org/en/service/${tosdrId}`}</a>
198 </li>
199 )}
200 { iosApp && (
201 <li>
202 <b>iOS App:</b>
203 <a href={iosApp}>{formatLink(iosApp)}</a>
204 </li>
205 )}
206 { url && (
207 <li>
208 <b>Web info:</b>
209 <a href={`https://web-check.xyz/results/${formatLink(url)}`}>{`web-check.xyz/results/${formatLink(url).split('/')[0]}`}</a>
210 </li>
211 )}
212 </ul>
213 </div>
214 </div>
215 <div class="highlights">
216 { securityAudited && (
217 <span class="meta-item great" title={`${name} has been security audited by an accredited auditor, with results published publicly`}>
218 <FontAwesome iconName="securityAudited" /> Security Audited
219 </span>
220 )}
221 { acceptsCrypto && (
222 <span class="meta-item great" title={`${name} accepts anonymous payment methods`}>
223 <FontAwesome iconName="cryptoAccepted" /> Crypto Payments Accepted
224 </span>
225 )}
226 { securityAudited === false && (
227 <span class="meta-item warning" title={`${name} has not been audited`}>
228 <FontAwesome iconName="notSecurityAudited" /> No Security Audit
229 </span>
230 )}
231 { (openSource === false) && (
232 <span class="warning">
233 <FontAwesome iconName="closedSource" />
234 Not Open Source
235 </span>
236 )}
237 { openSource || (github && openSource !== false) ? (
238 <span class="meta-item great" title={`${name} is open source`}>
239 <FontAwesome iconName="openSource" /> Open Source
240 </span>
241 ) : null }
242 </div>
243 </section>
244 { privacyData && (
245 <section>
246 <h3>{name} Privacy Policy</h3>
247 <PrivacyPolicyDetails privacyData={privacyData} />
248 </section>
249 )}
250 { github && githubData && (
251 <section class="github-wrap">
252 <h3>{name} Source Code</h3>
253 <GitHubDetailedInfo gitHubData={githubData} repo={github} />
254 </section>
255 )}
256 { websiteData && (
257 <section>
258 <h3>{name} Website</h3>
259 <WebsiteDetailedInfo url={url} websiteInfo={websiteData} />
260 </section>
261 )}
262 { iosData && (
263 <section>
264 <h3>{name} iOS App</h3>
265 <IosAppDetailedInfo url={url} iosData={iosData} />
266 </section>
267 )}
268 { dockerData && dockerData.found && (
269 <section>
270 <h3>{name} Docker</h3>
271 <DockerDetailedInfo docker={dockerData} />
272 </section>
273 )}
274
275 <section>
276 <h3>{name} Reviews</h3>
277 <Comments client:visible />
278 </section>
279
280 <section>
281 <h3>More {parentSection.name}</h3>
282 <ServiceList
283 services={filterServices()}
284 subHeading={true}
285 noGitHubMetrics={true}
286 buttonLink={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}
287 categoryName={categoryName}
288 sectionName={parentSection.name}
289 />
290 </section>
291 <section>
292 <h3>About the Data: {name}</h3>
293 <DataActions client:load categoryName={categoryName} sectionName={parentSection.name} serviceName={name} />
294 <h4>API</h4>
295 <p>
296 You can access {name}'s data programmatically via our API.
297 Simply make a <code>GET</code> request to:
298 </p>
299 <pre><a href={getApiEndpoint()}><code>{getApiEndpoint()}</code></a></pre>
300 <p>
301 The REST API is free, no-auth and CORS-enabled.
302 To learn more, view the <a href="/api">Swagger Docs</a> or read the <a href="/about#api">API Usage Guide</a>.
303 </p>
304
305 <h4>About the Data</h4>
306 <p>
307 Beyond the user-submitted YAML you see above, we also augment each listing with
308 additional data dynamically fetched from several sources.
309 To learn more about where the rest of data included in this page comes from,
310 and how it is computed,
311 see the <a href="/about#our-data">About the Data</a> section of our About page.
312 </p>
313 </section>
314
315 <section>
316 <h3>Share {name}</h3>
317 <p>
318 Help your friends compare {parentSection.name}, and pick privacy-respecting software and services.<br />
319 Share {name} and Awesome Privacy with your network!
320 <div>
321 <SocialShare
322 url={`${site}/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)} `}
323 title={`Checkout ${name}! \n`}
324 description={
325 `Compare #${name} and other privacy-respecting ${parentSection.name} at `
326 + `Awesome-Privacy.xyz, the free and open source list of private software alternatives. `
327 + `#privacy #opensource #awesomeprivacy by @Lissy_Sykes`}
328 />
329 </div>
330 </p>
331 </section>
332
333 <div class="pagination-navigation">
334 { previous ? (
335 <Button url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(previous)}`}>
336 <span>← Previous</span>
337 <p>{previous}</p>
338 </Button>
339 ) : <p class="nothing"></p>}
340 <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`} class="go-to-category">
341 View {parentSection.name} ({(parentSection.services || []).length})
342 </a>
343 { next && (
344 <Button url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(next)}`}>
345 <span>Next →</span>
346 <p>{next}</p>
347 </Button>
348 )}
349 </div>
350 </main>
351</Layout>
352
353<style lang="scss">
354
355main {
356 margin: 2rem auto;
357 padding: 1rem;
358 width: 1000px;
359 max-width: calc(100% - 5rem);
360 position: relative;
361 @media(max-width: 768px) {
362 max-width: 95%;
363 padding: 0.5rem;
364 margin: 0 auto;
365 }
366}
367
368section {
369 margin: 1rem 0 4rem 0;
370 padding: 1rem;
371 min-height: 8rem;
372 position: relative;
373 border: 2px solid var(--foreground);
374 box-shadow: 6px 6px 0 var(--foreground);
375 background: var(--accent-fg);
376
377}
378
379p {
380 margin: 0.25rem 0 0.5rem 0;
381}
382
383h3 {
384 font-size: 2rem;
385 margin: -2rem 0 1rem -2rem;
386 box-shadow: 6px 6px 0 var(--foreground);
387 background: var(--accent);
388 color: var(--accent-fg);
389 width: fit-content;
390 padding: 0.25rem 0.5rem;
391 @media(max-width: 768px) {
392 margin: -2rem auto 2rem auto;
393 }
394 }
395
396.service-head {
397 h2 {
398 font-size: 3rem;
399 margin: 0;
400 @media(max-width: 768px) {
401 text-align: center;
402 }
403 }
404 .url-wrap {
405 display: flex;
406 align-items: center;
407 gap: 0.5rem;
408 a {
409 font-size: 1.2rem;
410 }
411 .follow-with {
412 font-style: italic;
413 opacity: 0.6;
414 }
415 @media(max-width: 768px) {
416 flex-direction: column;
417 }
418 }
419
420}
421
422.breadcrumbs {
423 opacity: 0.5;
424 font-size: 0.8rem;
425 position: absolute;
426 right: 1rem;
427 top: 1rem;
428 a {
429 color: var(--foreground);
430 transition: all 0.15s ease-in-out;
431
432 &:hover {
433 color: var(--accent);
434 }
435 }
436 @media(max-width: 768px) {
437 display: none;
438 }
439}
440
441h4 {
442 font-size: 1.4rem;
443 margin-bottom: 0;
444}
445
446.intro {
447 font-size: 1.2rem;
448 font-style: italic;
449 opacity: 0.9;
450 display: flex;
451 gap: 0.5rem;
452 @media(max-width: 768px) {
453 flex-direction: column;
454 }
455 .service-icon {
456 border-radius: var(--curve-md);
457 margin-top: 1rem;
458 @media(max-width: 768px) {
459 margin: 1rem auto 0 auto;
460 }
461 }
462 ul {
463 padding-left: 1rem;
464 list-style: circle;
465 font-style: normal;
466 font-size: 1rem;
467 margin-top: 0;
468 b {
469 font-size: 1rem;
470 font-weight: 400;
471 min-width: 85px;
472 display: inline-block;
473 @media(max-width: 768px) {
474 width: auto;
475 display: block;
476 }
477 }
478 }
479}
480
481.pagination-navigation {
482 display: flex;
483 justify-content: space-between;
484 align-items: center;
485 padding: 1rem 0;
486 :global(.button) {
487 min-width: 120px;
488 width: fit-content;
489 padding: 0.25rem 1rem;
490 text-align: right;
491 &:first-child { text-align: left; }
492 p {
493 margin: 0;
494 font-weight: normal;
495 font-size: 1rem;
496 }
497 span {
498 font-size: 0.8rem;
499 }
500
501 }
502 .nothing {
503 width: 120px;
504 }
505 .go-to-category {
506 color: var(--foreground);
507 font-size: 0.8rem;
508 opacity: 0.5;
509 @media (max-width: 768px) {
510 display: none;
511 }
512 }
513}
514
515
516
517.further-info, .notable-mentions, .word-of-warning {
518 h3 {
519 font-size: 1.4rem;
520 margin: 1rem 0;
521 }
522 :global(p) {
523 font-size: 0.9rem;
524 opacity: 0.7;
525 :global(strong) {
526 font-weight: 500;
527 }
528 :global(a) {
529 color: var(--foreground);
530 transition: all 0.15s ease-in-out;
531 &:hover {
532 color: var(--accent);
533 }
534 }
535 }
536 :global(strong) {
537 font-weight: 500;
538 }
539 :global(h4) {
540 font-size: 1.2rem;
541 margin: 0.5rem 0 0 0;
542 }
543 :global(ul) {
544 list-style: circle;
545 padding-left: 1rem;
546 font-size: 0.9rem;
547 opacity: 0.7;
548 li {
549 margin-bottom: 0.25rem;
550 :global(p) {
551 display: inline;
552 }
553 }
554 }
555}
556
557pre {
558 a {
559 text-decoration: none;
560 color: var(--foreground);
561 code {
562 background: #acabb782;
563 padding: 0.2rem 0.4rem;
564 border-radius: var(--curve-sm);
565 font-family: Courier New;
566 font-size: 0.9rem;
567 @media(max-width: 768px) {
568 white-space: break-spaces;
569 }
570 }
571 }
572}
573
574.highlights {
575 display: flex;
576 gap: 1rem;
577 flex-wrap: wrap;
578 align-items: center;
579 justify-content: end;
580
581 .meta-item, .warning {
582 display: flex;
583 align-items: center;
584 // justify-content: center;
585 gap: 0.25rem;
586 opacity: 0.6;
587 font-size: 0.9rem;
588 padding: 0.5rem 0;
589 :global(svg) {
590 color: var(--foreground);
591 width: 1.2rem;
592 height: 1.2rem;
593 }
594 a {
595 text-decoration: none;
596 color: var(--foreground);
597 display: flex;
598 gap: 0.25rem;
599 &:hover {
600 color: var(--accent-3);
601 :global(svg) {
602 color: var(--accent-3);
603 }
604 }
605 }
606 }
607 .warning {
608 color: var(--danger);
609 :global(svg) {
610 color: var(--danger);
611 }
612 }
613 .great {
614 color: #007930; // var(--success);
615 :global(svg) {
616 color: #007930; // var(--success);
617 }
618 }
619}
620
621</style>